gtkplacessidebar: clean up trash row on destroy
authorCarlos Soriano <csoriano@gnome.org>
Fri, 26 Feb 2016 10:01:38 +0000 (11:01 +0100)
committerCarlos Soriano <csoriano@gnome.org>
Fri, 26 Feb 2016 10:52:50 +0000 (11:52 +0100)
Track with a weak ref the trash row, so we can clean up the data in the
private struct.

Spotted and reviewed by Christian Hergert.

gtk/gtkplacessidebar.c

index ba8d3c0241309dc5752bc1ed82c475673f11f2a0..6160504759aac7b801f76ee362f22a136ffca7be 100644 (file)
@@ -994,6 +994,7 @@ update_places (GtkPlacesSidebar *sidebar)
                                       _("Trash"), icon, mount_uri,
                                       NULL, NULL, NULL, 0,
                                       _("Open the trash"));
+      g_object_add_weak_pointer (G_OBJECT (sidebar->trash_row), &sidebar->trash_row);
       g_object_unref (icon);
     }
 
@@ -4041,6 +4042,12 @@ gtk_places_sidebar_dispose (GObject *object)
       g_clear_object (&sidebar->trash_monitor);
     }
 
+  if (sidebar->trash_row)
+    {
+      g_object_remove_weak_pointer (G_OBJECT (sidebar->trash_row), &sidebar->trash_row);
+      sidebar->trash_row = NULL;
+    }
+
   if (sidebar->volume_monitor != NULL)
     {
       g_signal_handlers_disconnect_by_func (sidebar->volume_monitor,